prevent RLE encoding of 1x1 pixel images, since the encoder comparison
author13:28:23 Tim Janik <timj@imendio.com>
Tue, 23 Sep 2008 11:30:35 +0000 (11:30 +0000)
committerTim Janik <timj@src.gnome.org>
Tue, 23 Sep 2008 11:30:35 +0000 (11:30 +0000)
2008-09-23 13:28:23  Tim Janik  <timj@imendio.com>

        * gdk-pixdata.c: prevent RLE encoding of 1x1 pixel images, since the
        encoder comparison operator requires at least 2 pixels, fixes #553374:
        Bug 553374 - gdk_pixdata_from_pixbuf fails for some images with use_rle set to TRUE

svn path=/trunk/; revision=21497

gdk-pixbuf/ChangeLog
gdk-pixbuf/gdk-pixdata.c

index 27f0a94f1a25a328a781003d73d5d3a468472972..fe218bf80a6b4d600ec330f06f67697187159412 100644 (file)
@@ -1,3 +1,9 @@
+2008-09-23 13:28:23  Tim Janik  <timj@imendio.com>
+
+       * gdk-pixdata.c: prevent RLE encoding of 1x1 pixel images, since the
+       encoder comparison operator requires at least 2 pixels, fixes #553374:
+       Bug 553374 - gdk_pixdata_from_pixbuf fails for some images with use_rle set to TRUE
+
 2008-09-19  Matthias Clasen  <mclasen@redhat.com>
 
        * gdk-pixbuf-io.c: Don't call fill_info if we've already filled
index cdd07107b0ba63b52ad7e26d89606c1e47074d52..e9cdf8f8504aa0d5ef7a1a8c01090cec60fab6e0 100644 (file)
@@ -328,8 +328,8 @@ gdk_pixdata_from_pixbuf (GdkPixdata      *pixdata,
 
   height = pixbuf->height;
   rowstride = pixbuf->rowstride;
-  encoding = use_rle ? GDK_PIXDATA_ENCODING_RLE : GDK_PIXDATA_ENCODING_RAW;
   bpp = pixbuf->has_alpha ? 4 : 3;
+  encoding = use_rle && ((rowstride / bpp | height) > 1) ? GDK_PIXDATA_ENCODING_RLE : GDK_PIXDATA_ENCODING_RAW;
 
   if (encoding == GDK_PIXDATA_ENCODING_RLE)
     {